<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型讲解</title>
</head>
<body>
    
</body>
</html>
<script>
    // 构造函数首字符要大写
    function Start(val,val1){
        this.name = val;
        this.age = val1;
    }
    // 只要是对象都要原型
    // prototype 就是构造函数的原型 原型也是一个对象
    Start.prototype.sing = function (){
        console.log('我会唱歌，非常好听');
    }
    let obj = new Start('张三',19);
    obj.num = 20
    obj.sing();
    console.log(obj);
    let obj1 = new Start('李四',18);
    obj1.sing();
</script>